package chaoyue.study.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试全局异常是否生效
 */
@RestController
@RequestMapping("test")
public class TestExceptionController {

    @GetMapping("error1")
    public String error1() {
        int i = 1 / 0;
        return "hello";
    }

    @GetMapping("error2")
    public String error2(){
        throw new RuntimeException("testException");
    }
}
